﻿<Controls:SinacorWindow
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:Custom="http://schemas.xceed.com/wpf/xaml/datagrid"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" 
    xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls"    
    WindowStartupLocation="CenterScreen" 
    WindowState="Normal" 
    Width="700"
    Height="700"
    Title="{DynamicResource Bovespa.Ordens.Label.MotivoAbertura}"
    x:Class="Sinacor.UI.Bovespa.Ordens.View.SmartClient.CadastroMotivos"
    ModulePlus="False"
    ModuleId="ORD">

    <Controls:SinacorExpanderContainer HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

        <Controls:SinacorExpander Header="{DynamicResource Bovespa.Ordens.Label.Motivos}"
                                  Margin="0,0,0,0" AllowExpand="False" >
            <Grid HorizontalAlignment="Stretch"
                  VerticalAlignment="Stretch">
                <Controls:SinacorDataGrid MinHeight="150"
                                          x:Name="dataMotivos"
                                          HorizontalAlignment="Stretch"
                                          VerticalAlignment="Stretch"
                                          Deleting="dataMotivos_Deleting"
                                          ItemsSource="{Binding ListaMotivos}"
                                          AllowSave="True"
                                          AllowDelete="True"
                                          CancelingInsert="dataMotivos_CancelingInsert"
                                          CancelingUpdate="dataMotivos_CancelingInsert"
                                          EndingInsert="dataMotivos_EndingInsert"
                                          EndingUpdate="dataMotivos_EndingUpdate">
                    <Controls:SinacorDataGrid.Columns>
                        <Controls:Column Name="NumCodigo" 
                                         DisplayMemberPath="Codigo"
                                         Title="Bovespa.Ordens.Label.codigo" 			
                                         IsRequired="True" 			
                                         AllowInsert="True" 			
                                         AllowUpdate="False"
                                         HorizontalCellAlignment="Right"
                                         AutoAdjustWidthToContent="False"
										 Width="100">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorInt32TextBox 
                                        x:Name="NumCodigoTemplate" 
                                        Value="{Binding Codigo}" 
                                        VerticalAlignment="Top"
                                        IsRequired="True"
                                        Integers="3"
                                        RequiredErrorMessage="Bovespa.Ordens.ExceptionMessage.CodigoMotivoObrigatorio"/>
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>

                        <Controls:Column Name="TextDescricao" 	
                                         DisplayMemberPath="Descricao"
                                         Title="Bovespa.Ordens.Label.descricao" 			
                                         IsRequired="True" 			
                                         AllowInsert="True" 			
                                         AllowUpdate="True"  
                                         CellInsertTemplate="{Binding CellUpdateTemplate, RelativeSource={RelativeSource Self}}"
                                         HorizontalCellAlignment="Left"
                                         AutoAdjustWidthToContent="False"
										 Width="410">
                            <Controls:Column.CellUpdateTemplate>
                                <DataTemplate>
                                    <Controls:SinacorTextBox 
                                        x:Name="TextDescricaoTemplate" 
                                        Text="{Binding Descricao}" 
                                        VerticalAlignment="Top"
                                        IsRequired="True"
                                        MaxLength="40"
                                        RequiredErrorMessage="Bovespa.Ordens.ExceptionMessage.DescricaoMotivoObrigatorio"></Controls:SinacorTextBox>
                                </DataTemplate>
                            </Controls:Column.CellUpdateTemplate>
                        </Controls:Column>
                    </Controls:SinacorDataGrid.Columns>
                </Controls:SinacorDataGrid>
            </Grid>
        </Controls:SinacorExpander>
    </Controls:SinacorExpanderContainer>
</Controls:SinacorWindow>